<template>
	<view>
		<view class="content-back">
			<scroll-view class='leftSelect' scroll-y="true">
				<leftSelect @clickleftAction="clickleftAction"></leftSelect>
			</scroll-view>
			<view class="right-content">
				<templateLib v-if="selectRow == 0 && selectcell == 0"></templateLib>
				<lawyerManage v-if="selectRow == 0 && selectcell == 1"></lawyerManage>
				<paramConfig v-if="selectRow == 0 && selectcell == 2"></paramConfig>
				<conflictManage v-if="selectRow == 0 && selectcell == 3"></conflictManage>
				<otherManage v-if="selectRow == 0 && selectcell == 4"></otherManage>
				<!-- 商品管理 -->
				<product v-if="selectRow == 1 && selectcell == 0"></product>
				<!-- 基础管理 -->
				<banner v-if="selectRow == 2 && selectcell == 0"></banner>
				<smallPage v-if="selectRow == 2 && selectcell == 1"></smallPage>
				<aboutUs v-if="selectRow == 2 && selectcell == 2"></aboutUs>
				<userMessage v-if="selectRow == 2 && selectcell == 3"></userMessage>
				<messageNotice v-if="selectRow == 2 && selectcell == 4"></messageNotice>
				<!-- 用户列表 -->
				<userList v-if="selectRow == 3 && selectcell == 0"></userList>
				<!-- 订单与服务 -->
				<order v-if="selectRow == 4 && selectcell == 0"></order>
				<serve v-if="selectRow == 4 && selectcell == 1"></serve>
				<!-- 系统设置 -->
				<systemSet v-if="selectRow == 5"></systemSet>
			</view>
		</view>
	</view>
</template>


<script>
	import leftSelect from "@/packageB/PC/public/leftSelect.vue"
	import lawyerManage from '@/packageB/PC/consultMange/lawyerManage/lawyerManage.vue'
	import templateLib from "@/packageB/PC/consultMange/templateLib/templateLib.vue"
	import conflictManage from "@/packageB/PC/consultMange/conflictManage/conflictManage.vue"
	import otherManage from "@/packageB/PC/consultMange/otherConfig.vue"
	import banner from "@/packageB/PC/basicManage/bannerManage.vue"
	import smallPage from "@/packageB/PC/basicManage/smallPage.vue"
	import aboutUs from "@/packageB/PC/basicManage/aboutUs.vue"
	import userList from "@/packageB/PC/userList/userList.vue"
	import order from "@/packageB/PC/orderServe/order.vue"
	import serve from "@/packageB/PC/orderServe/serve.vue"
	import systemSet from "@/packageB/PC/systemSet/index.vue"
	import userMessage from "@/packageB/PC/basicManage/userMessage.vue"
	import messageNotice from "@/packageB/PC/basicManage/messageNotice.vue"
	import product from "@/packageB/PC/productMange/productMange.vue"
	import paramConfig from "@/packageB/PC/consultMange/paramConfig/paramConfig.vue"
	export default {
		components: {
			leftSelect,
			lawyerManage,
			templateLib,
			conflictManage,
			banner,
			order,
			serve,
			systemSet,
			smallPage,
			aboutUs,
			userMessage,
			messageNotice,
			otherManage,
			product,
			userList,
			paramConfig
		},
		data() {
			return {
				selectRow: 0,
				selectcell: 0,
				//userInfo: {},
			}
		},
		onLoad() {
			//this.loginRequest();
			this.getOss();
		},

		methods: {

			clickleftAction(e) {
				this.selectRow = e.selectRow;
				this.selectcell = e.selectcell;

			},


			//网络请求示例
			async loginRequest() {
				let _this = this
				//请求参数
				let parmas = {
					'username': 'admin',
					'password': '123456',
				}
				const res = await this.$myRequest({
					url: "/oauth/login/token/passwd",
					data: parmas,
					header: {
						"Content-Type": "application/x-www-form-urlencoded",
						"Authorization": "Basic ZG90Z286ZG90Z28=",
					},
					method: 'POST', //默认是GET
				})
				console.log('返回结果', res)

				if (res.data.code == 200) {
					uni.setStorageSync("accessToken", res.data.data.accessToken)
					uni.setStorageSync("refreshToken", res.data.data.refreshToken)

					_this.getUser()
				}
			},
			//用户信息
			async getUser() {
				let _this = this

				const res = await _this.$myRequest({
					url: "/oauth/userinfo",
				})
				if (res.data.code == 200) {
					getApp().globalData.userInfo = res.data.data
					this.userInfo = res.data.data
				}

			},
			/**
			 * 获取上传文件临时秘钥
			 */
			async getOss() {
				let _this = this
				const res = await _this.$myRequest({
					url: "/comm/oss/sts",
					header: {
						"Authorization": "Basic ZG90Z286ZG90Z28=",
						"token": uni.getStorageSync("accessToken")
					},
				})
				console.log('获取oss上传临时密钥', res)
				if (res.data.code == 200) {
					getApp().globalData.upLoadAccess = res.data.data
					var time = Date.now()
					getApp().globalData.upLoadAccess.time = time
				}
			},

		},
	}
</script>

<style scoped>
	.content-back {
		display: flex;
		width: 100%;
	}

	.leftSelect {
		width: 16%;
		max-width: 200px;
		height: 100vh;
		border-right: 1px #eee solid;
		border-radius: 5px;
	}

	.right-content {
		width: 84%;
		min-width: 84%;
		background-color: white;
	}
</style>
